package br.com.wssa.email.ws.service.impl;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.HandlerChain;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

import br.com.wssa.email.dto.EmailDTO;
import br.com.wssa.email.ejb.service.EmailProducerService;
import br.com.wssa.email.exception.EmailException;

@Stateless
@WebService(name = "WSEmailService", targetNamespace = "service")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
@HandlerChain(file = "handler-chain.xml")
public class WSEmailServiceImpl {

	@EJB
	EmailProducerService email;

	public void enviaEmailAssincrono(@WebParam(name = "email") EmailDTO emailDTO) {
		try {
			email.enviarEmail(emailDTO);
		} catch (EmailException e) {
			e.printStackTrace();
		}
	}
}
